(function(){
	var AjaxCrud = QualityCheck.AjaxCRUD;
	var serverUrl = QualityCheck.GPUD.ServiceConfig;
	var currentPage = 1;
	var pageSize = 10;
	var totalSize;
	var now = 0;
	var classCaches = null;//班级数据
	var Subject = null;//科目数据
	var Index = 0;
	$(function(){
		var usercode = $("#user-name",parent.parent.document).attr("code");
		var userkey = $("#user-name",parent.parent.document).attr("key");
		var usertype = $("#user-name",parent.parent.document).attr("usertype");
		keyCheck(usercode,usertype,userkey,function(){
			initSmPages();
			window.onresize = function () {
				initSmPages();
			};
			pagebtns();
			initGradeClass();
		});
	});
	function initGradeClass(){
		var userKey = $("#user-name",parent.parent.document).attr("key");
		var userRoles = $("#user-name",parent.parent.document).attr("rolecodes");
		var data = {
				cmd:"getDataRole",
				model:"license",
				userKey:userKey,
				data:{
					rolecode:userRoles
				},
				remark:"",
		};
		AjaxCrud.get2(serverUrl.ServerLoginUrl,data,function(res){
			classCaches = res;
			var typeOpt = "<option value='' >学段</option>";
			if(res.result == 1 && res.data != undefined && res.data != ""){
				var data = res.data;
				for(var i = 0; i < data.length; i++){
					var name = "";
					if(data[i].type == "0"){
						name = "幼儿园";
					}else if(data[i].type == "1"){
						name = "小学";
					}else if(data[i].type == "2"){
						name = "中学";
					}else if(data[i].type == "3"){
						name = "高中";
					}
					typeOpt += "<option value='"+data[i].type+"'>"+name+"</option>";
				}
				$("#student-type").html(typeOpt);
				
				$("#student-type").unbind("change");
				$("#student-type").change(function(){
					var gradeData = null;
					var type = $("#student-type option:selected").val();
					var gradeOpt = "<option value='' classcodes='' classes=''>年级</option>";
					if(type != ""){
						for(var i = 0; i < data.length; i++){
							if(data[i].type == type){
								gradeData = data[i].data;
							}
						}
						for(var i = 0; i < gradeData.length; i++){
							gradeOpt += "<option value='"+gradeData[i].grade+"' classcodes='"+gradeData[i].classcode+"' classes='"+gradeData[i].classes+"'>"+gradeData[i].grade+"年级</option>";
						}
					}
					$("#student-grade").html(gradeOpt);
					
					var classOpt = "<option value='' classes=''>班级</option>";
					$("#student-classcode").html(classOpt);
					initExam(1,pageSize);
				});
				
				$("#student-grade").unbind("change");
				$("#student-grade").change(function(){
					var classes = $("#student-grade option:selected").attr("classes").split(",");
					var classcodes = $("#student-grade option:selected").attr("classcodes").split(",");
					var classOpt = "";
					for(var j = 0; j < classes.length; j++){
						if(classcodes[j] == "" && classes[j] == ""){
							classOpt += "<option value='' classes=''>班级</option>";
						}else{
							classOpt += "<option value='"+classcodes[j]+"' classes='"+classes[j]+"'>"+classes[j]+"班</option>";
						}
					}
					$("#student-classcode").html(classOpt);
					initExam(1,pageSize);
				});
				$("#student-classcode").unbind("change");
				$("#student-classcode").change(function(){
					initExam(1,pageSize);
				});
			}else{
				
			}
			initExam(1,pageSize);
		},null,null);
	}
	function initExam(currentpage,pagesize){
		var userKey = $("#user-name",parent.parent.document).attr("key");
		var schoolcode = $("#user-name",parent.parent.document).attr("schoolcode");
		var rolecode = $("#user-name",parent.parent.document).attr("rolecodes");
		var starttime = strToDate($("#start-time").val() + "-01 00:00:00")/1000;
		var endtime = strToDate($("#end-time").val() + "-01 00:00:00")/1000;
		var type = $("#student-type option:selected").val();
		var classcode = $("#student-classcode option:selected").val();
		var obj = {
				type:type,
				classcode:classcode,
				rolecode:rolecode,
				schoolcode:schoolcode,
				currentpage:currentpage,
				pagesize:pagesize,
		};
		if($("#start-time").val() != "" && $("#end-time").val() != ""){
			obj.starttime = starttime;
			obj.endtime = endtime;
			$("#judge-time").hide();
		}else if($("#start-time").val() == "" && $("#end-time").val() == ""){
			$("#judge-time").hide();
		}else{
			$("#judge-time").text("请把时间填充完整");
			$("#judge-time").show();
			return false;
		}
		var data = {
				cmd:"getAllExamInfo",
				model:"bigexam",
				userKey:userKey,
				data:obj,
				remark:"",
				
		};
		processBegin("正在运行中···");
		AjaxCrud.get(serverUrl.ServerLoginUrl,data,function(res){
			var content = "";
			var pagecontent = "<div class=\"pages-btn-next\">&gt;&gt;</div>";
			if(res.result == 1 && res.data != undefined && res.data != ""){
				processEnd("查询成功");
				var data = res.data.data;
				if(data.length > 0){
					var total = res.data.total;
					totalSize = Math.ceil(total/pagesize);
					if(totalSize <= 5 && totalSize >0){
						for(var i = totalSize-1 ; i >= 0; i--){
							if(i == currentpage-1){
								pagecontent += "<div class=\"pages-btn page-btn-select\">"+(i + 1)+"</div>"; 
							}else{
								pagecontent += "<div class=\"pages-btn\">"+(i + 1)+"</div>"; 
							}
						}
					}else if(totalSize == 0){
						pagecontent += "<div class=\"pages-btn\">1</div>";
					}else if(totalSize > 5){
						var lastp = (now*5)+5;
						if(lastp > totalSize){
							lastp = totalSize;
						}
						for(var i = lastp-1 ; i >= (now*5); i--){
							if(i == currentpage-1){
								pagecontent += "<div class=\"pages-btn page-btn-select\">"+(i + 1)+"</div>"; 
							}else{
								pagecontent += "<div class=\"pages-btn\">"+(i + 1)+"</div>"; 
							}
						}
					}
					pagecontent += "<div class=\"pages-btn-last\">&lt;&lt;</div>";
					$("#student-page").empty();
					$("#student-page").append(pagecontent);
					
					$(".pages-btn").unbind("click");
					$(".pages-btn").click(function(){
						$(".pages-btn").removeClass("page-btn-select");
						$(this).addClass("page-btn-select");
						currentPage = parseInt($(this).text());
						initExam(currentPage,pageSize);
					});
					
					$(".pages-btn-last").unbind("click");
					$(".pages-btn-last").click(function(){
						if(totalSize <= 5 && totalSize >0){
							return false;
						}else if(totalSize == 0){
							return false;
						}else if(totalSize > 5){
							if(now > 0){
								now --;
								initExam((now*5+1),pageSize);
							}else{
								return false;
							}
						}
					});
					
					$(".pages-btn-next").unbind("click");
					$(".pages-btn-next").click(function(){
						if(totalSize <= 5 && totalSize >0){
							return false;
						}else if(totalSize == 0){
							return false;
						}else if(totalSize > 5){
							if(totalSize%5 == 0){
								if((now+1) < totalSize/5){
									now ++;
									initExam((now*5+1),pageSize);
								}else{
									return false;
								}
							}else{
								if((now+1) <= (totalSize-totalSize%5)/5){
									now ++;
									initExam((now*5+1),pageSize);
								}else{
									return false;
								}
							}
						}
					});
					if(data.length > 0){
						for(var i = 0; i < data.length; i++){
							for(var key in data[i]){
								if(data[i][key] == null || data[i][key] == "null" || data[i][key] == undefined){
									data[i][key] = "";
								}
							}
							content += "<div class=\"table-trs\">" +
								"<div class=\"tables-left\" style='margin-left:15px;width:320px;'>" +
									"<div class=\"table-name\" style='width:320px;' coursename='"+data[i].coursename+"' examcode=\""+data[i].examcode+"\" grade=\""+data[i].grades+"\" schooltype=\""+data[i].schooltype+"\" title='"+data[i].examname+"'><a href='javascript:void(0)' class='into-exam-detail'>"+substr(data[i].examname,15) + "</a></div>" +
									"<div class=\"table-code\" style='width:320px;' title='"+data[i].describe+"'>"+substr(data[i].describe,20)+"</div>" +
								"</div>" +
								"<div class=\"tables-right\">" +
									"<div class=\"table-address\">创建于:"+getFormatDateByLong(parseInt(data[i].createtime)*1000,"yyyy-MM-dd hh:mm")+"</div>" +
									"<div class=\"table-oprate\">" +
										"<div class=\"table-ranking\" dataindex = \""+i+"\" examcode=\""+data[i].examcode+"\" examname=\""+data[i].examname+"\" grade=\""+data[i].grades+"\" schooltype=\""+data[i].schooltype+"\" title=\"排名\"></div>" +
										"<div class=\"table-detail\" dataindex = \""+i+"\" examcode=\""+data[i].examcode+"\" title=\"详情\" style='margin-left:15px;'></div>" +
										"<div class=\"table-edit\" dataindex = \""+i+"\" examcode=\""+data[i].examcode+"\" title=\"编辑\"></div>" +
										"<div class=\"table-delete\" examcode=\""+data[i].examcode+"\" title=\"删除\"></div>" +
									"</div>" +
								"</div>" +
							"</div>";
						}
						$("#exam-data-show").empty();
						$("#exam-data-show").append(content);
						
						$(".table-trs").unbind("hover");
						$(".table-trs").hover(function(){
							$(this).find(".table-oprate").show();
						},function(){
							$(".table-oprate").hide();
						});
						
						$(".table-name").unbind("click");
						$(".table-name").click(function(){
							var examcode = $(this).attr("examcode");
							var examname = $(this).attr("title");
							var grade = $(this).attr("grade");
							var schooltype = $(this).attr("schooltype");
							$("#result-form-show").contents().find(".table-title").text(examname + "总榜");
							$("#result-form-show").show();
							$("#right-tables").hide();
							$(".title-search").hide();
							$("#result-form-show").contents().find("#back-to-table").unbind("click");
							$("#result-form-show").contents().find("#back-to-table").click(function(){
								$("#result-form-show").hide();
								$("#right-tables").show();
								$(".title-search").show();
							});						
							getExamResult(examcode,examname,grade,schooltype);
						});
						
						$(".table-ranking").unbind("click");
						$(".table-ranking").click(function(){
							var examcode = $(this).attr("examcode");
							var examname = $(this).attr("examname");
							var grade = $(this).attr("grade");
							var schooltype = $(this).attr("schooltype");
							$("#ranking-form-show").show();
							$("#right-tables").hide();
							$(".title-search").hide();
							$("#title-search-ranking").show();
							initRankClass(examcode,examname,grade,schooltype);
							
							$("#ranking-form-show").contents().find("#back-to-table").unbind("click");
							$("#ranking-form-show").contents().find("#back-to-table").click(function(){
								$("#right-tables").show();
								$("#ranking-form-show").hide();
								$(".title-search").hide();
								$("#title-search-exam").show();
							});
						});
						
						$(".table-detail").unbind("click");
						$(".table-detail").click(function(){
							var flag = "detail";
							var examcode = $(this).attr("examcode");
							getExamDetail(examcode,flag);
							
							$("#exam-form-show").contents().find("#back-to-table").unbind("click");
							$("#exam-form-show").contents().find("#back-to-table").click(function(){
								$("#exam-form-show").hide();
								$("#right-tables").show();
								Index = 0;
							});
						});
						
						$(".table-edit").unbind("click");
						$(".table-edit").click(function(){
							var flag = "edit";
							var examcode = $(this).attr("examcode");
							getExamDetail(examcode,flag);
							
							$("#exam-form-show").contents().find("#back-to-table").unbind("click");
							$("#exam-form-show").contents().find("#back-to-table").click(function(){
								$("#exam-form-show").hide();
								$("#right-tables").show();
								Index = 0;
							});
							
							$("#exam-form-show").contents().find("#save-btns").unbind("click");
							$("#exam-form-show").contents().find("#save-btns").click(function(){
								if(checkSave()){
									if(check2()){
										updataExam(examcode);
									}
								}
								Index = 0;
							});
							check1("exam-examname",isNull,"null","exam-form-show");
							check1("exam-describe",isNull,"null","exam-form-show");
							
						});
						
						$(".table-delete").unbind("click");
						$(".table-delete").click(function(){
							var examcode = $(this).attr("examcode");
							deleteBox("确定要删除吗？",function(){
								deleteExam(examcode);
							});
						});
					}else{
						content += "<div class=\"table-trs\">" +
										"<div class=\"no-data-show\">没有查到相关结果！</div>" +
									"</div>";
						$("#exam-data-show").empty();
						$("#exam-data-show").append(content);
					}
				}else{
					content += "<div class=\"table-trs\">" +
									"<div class=\"no-data-show\">没有查到相关结果！</div>" +
								"</div>";
					$("#exam-data-show").empty();
					$("#exam-data-show").append(content);
				}
			}else{
				processError("查询失败");
				content += "<div class=\"table-trs\">" +
								"<div class=\"no-data-show\">没有查到相关结果！</div>" +
							"</div>";
				$("#exam-data-show").empty();
				$("#exam-data-show").append(content);
			}
			initClassEdit();
		},null,null);	
	}
	
	function initClassEdit(){
		var typeOpt = "";
		var res = classCaches;
		if(res.result == 1 && res.data != undefined && res.data != ""){
			var data = res.data;
			for(var i = 0; i < data.length; i++){
				var name = "";
				if(data[i].type == "0"){
					name = "幼儿园";
				}else if(data[i].type == "1"){
					name = "小学";
				}else if(data[i].type == "2"){
					name = "中学";
				}else if(data[i].type == "3"){
					name = "高中";
				}
				typeOpt += "<option value='"+data[i].type+"'>"+name+"</option>";
			}
			$("#exam-form-show").contents().find("#exam-type").html(typeOpt);
			
			$("#exam-form-show").contents().find("#exam-type").unbind("change");
			$("#exam-form-show").contents().find("#exam-type").change(function(){
				var gradeData = null;
				var type = $("#exam-form-show").contents().find("#exam-type option:selected").val();
				var gradeOpt = "";
				if(type != ""){
					for(var i = 0; i < data.length; i++){
						if(data[i].type == type){
							gradeData = data[i].data;
						}
					}
					for(var i = 0; i < gradeData.length; i++){
						gradeOpt += "<option value='"+gradeData[i].grade+"' classcodes='"+gradeData[i].classcode+"' classes='"+gradeData[i].classes+"'>"+gradeData[i].grade+"年级</option>";
					}
				}
				$("#exam-form-show").contents().find("#exam-grade").html(gradeOpt);
				
				var classOpt = "";
				var classes = $("#exam-form-show").contents().find("#exam-grade option:selected").attr("classes").split(",");
				var classcodes = $("#exam-form-show").contents().find("#exam-grade option:selected").attr("classcodes").split(",");
				for(var j = 0; j < classes.length; j++){
					classOpt += "<div class='classcode-item'><input type='checkbox' value='"+classcodes[j]+"' classes='"+classes[j]+"'><span>"+classes[j]+"班</span></div>";
				}
				$("#exam-form-show").contents().find("#exam-classcode").html(classOpt);
			});
			
			$("#exam-form-show").contents().find("#exam-grade").unbind("change");
			$("#exam-form-show").contents().find("#exam-grade").change(function(){
				var classes = $("#exam-form-show").contents().find("#exam-grade option:selected").attr("classes").split(",");
				var classcodes = $("#exam-form-show").contents().find("#exam-grade option:selected").attr("classcodes").split(",");
				var classOpt = "";
				for(var j = 0; j < classes.length; j++){
					classOpt += "<div class='classcode-item'><input type='checkbox' value='"+classcodes[j]+"' classes='"+classes[j]+"'><span>"+classes[j]+"班</span></div>";
				}
				$("#exam-form-show").contents().find("#exam-classcode").html(classOpt);
			});		
		}else{
			
		}
		getAllCourseSubject();
	}
	
	function getAllCourseSubject(){
		var userKey = $("#user-name",parent.parent.document).attr("key");	
		var schoolcode = $("#user-name",parent.parent.document).attr("schoolcode");
		var type = $("#exam-form-show").contents().find("#exam-type option:selected").val();
		var data = {
				cmd:"getAllCourseSubject",
				model:"course",
				userKey:userKey,
				data:{
					type:type,
					schoolcode:schoolcode
				},
				remark:"",
				
		};
		AjaxCrud.get(serverUrl.ServerLoginUrl,data,function(res){
			if(res.result == 1){
				var data = res.data;
				Subject = data;
				var cont = "<option value='' coursename=''>科目</option>";
				for(var i = 0; i < data.length; i++){
					cont += "<option value='"+data[i].subjectcode+"' coursename='"+data[i].coursecontent+"'>"+data[i].coursecontent+"</option>";
				}
				$("#exam-form-show").contents().find(".exam-coursename").html(cont);
			}
		},null,null);
	}
	function getExamDetail(examcode,flag){
		var userKey = $("#user-name",parent.parent.document).attr("key");
		var schoolcode = $("#user-name",parent.parent.document).attr("schoolcode");
		var data = {
				cmd:"getExamDetial",
				model:"bigexam",
				userKey:userKey,
				data:{
					examcode:examcode,
					schoolcode:schoolcode
				},
				remark:"",
		};
		AjaxCrud.get2(serverUrl.ServerLoginUrl,data,function(res){
			showData(res,flag);
		},null,null);
	}
	
	function showData(res,type){
		$("#exam-form-show").show();
		$("#right-tables").hide();
		if(type == "detail"){
			$("#exam-form-show").contents().find("#save-btns-content").hide();
		}else if(type == "edit"){
			$("#exam-form-show").contents().find("#save-btns-content").show();
		}
		$("#exam-form-show").contents().find("#add-info-cont").html("");
		if(res.result == 1 && res.data != undefined && res.data != ""){
			var data = res.data[0];
			$("#exam-form-show").contents().find("#exam-examname").val(data.examname);
			$("#exam-form-show").contents().find("#exam-describe").val(data.describe);
			$("#exam-form-show").contents().find("#exam-type option").each(function(i){
				if(data.schooltype == this.value){
					$(this).attr("selected",true);
					$("#exam-form-show").contents().find("#exam-type").change();
					return false;
				}
			});
			$("#exam-form-show").contents().find("#exam-grade option").each(function(i){
				if(this.value == data.grades){
					$(this).attr("selected",true);
					return false;
				}
			});
			var classOpt = "";
			var classes = $("#exam-form-show").contents().find("#exam-grade option:selected").attr("classes").split(",");
			var classcodes = $("#exam-form-show").contents().find("#exam-grade option:selected").attr("classcodes").split(",");
			for(var j = 0; j < classes.length; j++){
				classOpt += "<div class='classcode-item'><input type='checkbox' value='"+classcodes[j]+"' classes='"+classes[j]+"'><span>"+classes[j]+"班</span></div>";
			}
			$("#exam-form-show").contents().find("#exam-classcode").html(classOpt);
			
			var classcodeArr = data.classcode.split(",");
			for(var i = 0; i < classcodeArr.length; i++){
				$("#exam-form-show").contents().find(".classcode-item input").each(function(){
					if(this.value == classcodeArr[i]){
						$(this).attr("checked","checked");
					}
				});
			}
			var list = data.courselist;
			if(list.length > 0){
				for(var i = 0; i < list.length; i ++){
					addCourcont(list[i],i);
					$("#exam-form-show").contents().find(".exam-coursename" + i + " option").each(function(){
						if(this.value == list[i].coursecode){
							$(this).attr("selected",true);
							return false;
						}
					});
				}
			}
		}else{
			processError("查询失败");
			addCourcont1();
		}
		if(type == "detail"){
			$("#exam-form-show").contents().find(".btn-cont").hide();
			$("#exam-form-show").contents().find("input").attr("disabled","disabled");
			$("#exam-form-show").contents().find("input").css("background-color","#E5E5E5");
			$("#exam-form-show").contents().find("select").attr("disabled","disabled");
			$("#exam-form-show").contents().find("select").css("background-color","#E5E5E5");
			$("#exam-form-show").contents().find("textarea").attr("disabled","disabled");
			$("#exam-form-show").contents().find("textarea").css("background-color","#E5E5E5");
			$("#exam-form-show").contents().find("#exam-classcode").css("background-color","#E5E5E5");
		}else if(type == "edit"){
			$("#exam-form-show").contents().find(".btn-cont").show();
			$("#exam-form-show").contents().find(".table-middle input").removeAttr("disabled");
			$("#exam-form-show").contents().find(".table-middle input").css("background-color","#fff");
			$("#exam-form-show").contents().find("select").removeAttr("disabled");
			$("#exam-form-show").contents().find("select").css("background-color","#fff");
			$("#exam-form-show").contents().find("textarea").removeAttr("disabled");
			$("#exam-form-show").contents().find("textarea").css("background-color","#fff");
			$("#exam-form-show").contents().find("#exam-classcode").css("background-color","#fff");
		}
	}
	
	function addCourcont(data,index){
		var cont = "<div class='add-info-edit info-edit"+index+"' index='"+index+"'>" +
				"<input type='text' class='Wdate exam-stime' readonly='readonly' id='exam-stime"+Index+"' index='"+Index+"' value='"+getFormatDateByLong(parseInt(data.starttime)*1000,"yyyy-MM-dd hh:mm")+"'/>" +
				"<input type='text' class='Wdate exam-etime' readonly='readonly' id='exam-etime"+Index+"' index='"+Index+"' value='"+getFormatDateByLong(parseInt(data.endtime)*1000,"yyyy-MM-dd hh:mm")+"'/>" +
				"<select class='exam-coursename"+index+"'><option  value='' coursename=''>科目</option></select>" +
				"<input type='text' placeholder='满分值' style='width:100px;' value='"+data.score+"'>" +
				"<div class='btn-cont btn-add btn-edit"+index+"' index='"+index+"'>+</div>" +
				"<span class='info-error' id='info-error"+index+"' index='"+index+"'></span>" +
			"</div>";
		$("#exam-form-show").contents().find("#add-info-cont").append(cont);
		
		var cont = "<option value='' coursename=''>科目</option>";
		for(var i = 0; i < Subject.length; i++){
			cont += "<option value='"+Subject[i].subjectcode+"' coursename='"+Subject[i].coursecontent+"'>"+Subject[i].coursecontent+"</option>";
		}
		$("#exam-form-show").contents().find(".exam-coursename" + index).html(cont);
		
		if(index > 0){
			$("#exam-form-show").contents().find(".btn-edit" + (index-1)).removeClass("btn-add").addClass("btn-del");
			$("#exam-form-show").contents().find(".btn-edit" + (index-1)).html("-");
		}
		Index ++;
		
		$("#exam-form-show").contents().find(".btn-add").unbind("click");
		$("#exam-form-show").contents().find(".btn-add").bind("click",function(){
			addCourcont1();
		});
		
		$("#exam-form-show").contents().find(".btn-del").unbind("click");
		$("#exam-form-show").contents().find(".btn-del").bind("click",function(){
			var index = $("#exam-form-show").contents().find(this).attr("index");
			$("#exam-form-show").contents().find(".info-edit"+parseInt(index)).remove();
		});
		
		$("#exam-form-show").contents().find(".exam-stime").unbind("click");
		$("#exam-form-show").contents().find(".exam-stime").bind("click",function(){
			var index = $("#exam-form-show").contents().find(this).attr("index");
			var date = $("#exam-form-show").contents().find("#exam-etime" + index).val() + ":00";
			if($("#exam-form-show").contents().find("#exam-etime" + index).val() == ""){
				WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'});
			}else{
				var dates = getFormatDateByLong(strToDate(date) - 6*60*60*1000,"yyyy-MM-dd hh:mm:ss");
				WdatePicker({minDate:dates,maxDate:date,dateFmt:'yyyy-MM-dd HH:mm'});
			}
		});
		$("#exam-form-show").contents().find(".exam-etime").unbind("click");
		$("#exam-form-show").contents().find(".exam-etime").bind("click",function(){
			var index = $("#exam-form-show").contents().find(this).attr("index");
			var date = $("#exam-form-show").contents().find("#exam-stime" + index).val() + ":00";
			if($("#exam-form-show").contents().find("#exam-stime" + index).val() == ""){
				WdatePicker({minDate:date,dateFmt:'yyyy-MM-dd HH:mm'});
			}else{
				var dates = getFormatDateByLong(strToDate(date) + 6*60*60*1000,"yyyy-MM-dd hh:mm:ss");
				WdatePicker({minDate:date,maxDate:dates,dateFmt:'yyyy-MM-dd HH:mm'});
			}
		});
		
	}
	
	function addCourcont1(){
		var cont = "<div class='add-info-edit info-edit"+Index+"' index='"+Index+"'>" +
						"<input type='text' class='Wdate exam-stime' readonly='readonly' id='exam-stime"+Index+"' index='"+Index+"'/>" +
						"<input type='text' class='Wdate exam-etime' readonly='readonly' id='exam-etime"+Index+"' index='"+Index+"'/>" +
						"<select class='exam-coursename"+Index+"' ><option value='' coursename=''>科目</option></select>" +
						"<input type='text' placeholder='满分值' style='width:100px;'>" +
						"<div class='btn-cont btn-add btn-edit"+Index+"' index='"+Index+"'>+</div>" +
						"<span class='info-error' id='info-error"+Index+"' index='"+Index+"'></span>" +
					"</div>";
		$("#exam-form-show").contents().find("#add-info-cont").append(cont);
		
		var cont = "<option value='' coursename=''>科目</option>";
		for(var i = 0; i < Subject.length; i++){
			cont += "<option value='"+Subject[i].subjectcode+"' coursename='"+Subject[i].coursecontent+"'>"+Subject[i].coursecontent+"</option>";
		}
		$("#exam-form-show").contents().find(".exam-coursename" + Index).html(cont);
		
		if(Index > 0){
			$("#exam-form-show").contents().find(".btn-edit" + (Index-1)).removeClass("btn-add").addClass("btn-del");
			$("#exam-form-show").contents().find(".btn-edit" + (Index-1)).html("-");
		}
		Index++;
		
		$("#exam-form-show").contents().find(".btn-add").unbind("click");
		$("#exam-form-show").contents().find(".btn-add").bind("click",function(){
			addCourcont1();
		});
		
		$("#exam-form-show").contents().find(".btn-del").unbind("click");
		$("#exam-form-show").contents().find(".btn-del").bind("click",function(){
			var index = $("#exam-form-show").contents().find(this).attr("index");
			$("#exam-form-show").contents().find(".info-edit"+parseInt(index)).remove();
		});
		
		$("#exam-form-show").contents().find(".exam-stime").unbind("click");
		$("#exam-form-show").contents().find(".exam-stime").bind("click",function(){
			var index = $("#exam-form-show").contents().find(this).attr("index");
			var date = $("#exam-form-show").contents().find("#exam-etime" + index).val() + ":00";
			if($("#exam-form-show").contents().find("#exam-etime" + index).val() == ""){
				WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'});
			}else{
				var dates = getFormatDateByLong(strToDate(date) - 6*60*60*1000,"yyyy-MM-dd hh:mm:ss");
				WdatePicker({minDate:dates,maxDate:date,dateFmt:'yyyy-MM-dd HH:mm'});
			}
		});
		$("#exam-form-show").contents().find(".exam-etime").unbind("click");
		$("#exam-form-show").contents().find(".exam-etime").bind("click",function(){
			var index = $("#exam-form-show").contents().find(this).attr("index");
			var date = $("#exam-form-show").contents().find("#exam-stime" + index).val() + ":00";
			if($("#exam-form-show").contents().find("#exam-stime" + index).val() == ""){
				WdatePicker({minDate:date,dateFmt:'yyyy-MM-dd HH:mm'});
			}else{
				var dates = getFormatDateByLong(strToDate(date) + 6*60*60*1000,"yyyy-MM-dd hh:mm:ss");
				WdatePicker({minDate:date,maxDate:dates,dateFmt:'yyyy-MM-dd HH:mm'});
			}
		});
	}
	
	function initRankClass(examcode,examname,grade,schooltype){
		var typeOpt = "";
		var res = classCaches;
		if(res.result == 1 && res.data != undefined && res.data != ""){
			var data = res.data;
			var name = "";
			if(schooltype == "0"){
				name = "幼儿园";
			}else if(schooltype == "1"){
				name = "小学";
			}else if(schooltype == "2"){
				name = "中学";
			}else if(schooltype == "3"){
				name = "高中";
			}
			typeOpt += "<option value='"+schooltype+"' selected='selected'>"+name+"</option>";
			$("#ranking-type").html(typeOpt);
			
			var gradeOpt = "";
			if(schooltype != ""){
				for(var i = 0; i < data.length; i++){
					if(data[i].type == schooltype){
						gradeData = data[i].data;
					}
				}
				for(var i = 0; i < gradeData.length; i++){
					if(gradeData[i].grade == grade){
						gradeOpt += "<option value='"+gradeData[i].grade+"' classcodes='"+gradeData[i].classcode+"' classes='"+gradeData[i].classes+"' selected='selected'>"+gradeData[i].grade+"年级</option>";
					}
				}
			}
			$("#ranking-grade").html(gradeOpt);
			
			var classOpt = "<option value='' classes=''>班级</option>";
			var classes = $("#ranking-grade option:selected").attr("classes").split(",");
			var classcodes = $("#ranking-grade option:selected").attr("classcodes").split(",");
			for(var j = 0; j < classes.length; j++){
				classOpt += "<option value='"+classcodes[j]+"' classes='"+classes[j]+"'>"+classes[j]+"班</option>";
			}
			$("#ranking-classcode").html(classOpt);
			
			$("#ranking-classcode").unbind("change");
			$("#ranking-classcode").change(function(){
				initRanking(examcode,examname);
			});
		}else{
			
		}
		initRanking(examcode,examname);
	}
	//考试排名信息
	function initRanking(examcode,examname){
		processBegin("正在运行中···");
		var userKey = $("#user-name",parent.parent.document).attr("key");
		var schoolcode = $("#user-name",parent.parent.document).attr("schoolcode");
		var rolecode = $("#user-name",parent.parent.document).attr("rolecodes");
		var grade = $("#ranking-grade option:selected").val();
		var classcode = $("#ranking-classcode option:selected").val();
		var obj = {
				examcode:examcode,
				classcode:classcode,
				schoolcode:schoolcode,
				rolecode:rolecode,
				grades:grade,
		};
		var data = {
				cmd:"getExamTotalList",
				model:"bigexam",
				userKey:userKey,
				data:obj,
				remark:"",
				
		};
		AjaxCrud.get(serverUrl.ServerLoginUrl,data,function(res){
			$("#ranking-form-show").contents().find("#table-title").html(examname + "总榜");
			var content = "";
			if(res.result == 1 && res.data != undefined && res.data != ""){
				processEnd("查询成功");
				var data = res.data.data;
				if(data.length > 0){
					var subjTitcont = "";
					var subjinfo = data[0].subjectinfo;
					for(var i = 0; i < subjinfo.length; i++){
						subjTitcont += "<td>"+subjinfo[i].subject+"</td>";
					}
					content += "<table class='ranking-table'><tr><td>姓名</td><td>学号</td><td>班级</td>"+subjTitcont+"<td>总分</td><td>班排名</td><td>校排名</td></tr>";
					for(var i = 0; i < data.length; i++){
						var subjcont = "";
						var subjArr = data[i].subjectinfo;
						for(var k = 0; k < subjArr.length; k++){
							subjcont += "<td>"+subjArr[k].score+"</td>";
						}
						content += "<tr><td>"+data[i].studentname+"</td><td>"+data[i].studentcode+"</td><td>"+data[i].classesname+"</td>"+subjcont+"<td>"+data[i].scorenumber+"</td><td>"+data[i].classranking+"</td><td>"+data[i].schoolrank+"</td></tr>";
					}
					content += "</table>";
					$("#ranking-form-show").contents().find("#result-data-show").empty();
					$("#ranking-form-show").contents().find("#result-data-show").append(content);
					
					var cdsH =$("#ranking-form-show").height() - $("#ranking-form-show").contents().find(".content-title").height() - 40;
					$("#ranking-form-show").contents().find(".content-data-show").height(cdsH);
					
					//导出成绩排名榜
					$("#ranking-form-show").contents().find("#leadingout-btn").unbind("click");
					$("#ranking-form-show").contents().find("#leadingout-btn").click(function(){
						exportRanking(examcode);
					
					});
					
				}else{
					content += 	"<div class=\"table-trs\">" +
									"<div class=\"no-data-show\">没有查到相关结果！</div>" +
								"</div>";
					$("#ranking-form-show").contents().find("#result-data-show").empty();
					$("#ranking-form-show").contents().find("#result-data-show").append(content);
				}
			}else{
				processError("查询失败");
				content += "<div class=\"table-trs\">" +
								"<div class=\"no-data-show\">没有查到相关结果！</div>" +
							"</div>";
				$("#ranking-form-show").contents().find("#result-data-show").empty();
				$("#ranking-form-show").contents().find("#result-data-show").append(content);
			}
		},null,null);	
	}
	
	//点击考试名称查看科目详情
	function getExamResult(examcode,examname,grade,schooltype){
		processBegin("正在运行中···");
		var userKey = $("#user-name",parent.parent.document).attr("key");
		var data = {
				cmd:"getOneExamInfo",
				model:"bigexam",
				userKey:userKey,
				data:{
					examcode:examcode,
					grades:grade,
					schooltype:schooltype
				},
				remark:"",						
		};
		AjaxCrud.get(serverUrl.ServerLoginUrl,data,function(res){
			var content = "";
			if(res.result == 1 && res.data != undefined && res.data != ""){
				processEnd("查询成功");
				var data = res.data;
				if(data.length > 0){
					for(var i = 0; i < data.length; i++){
						for(var key in data[i]){
							if(data[i][key] == null || data[i][key] == "null" || data[i][key] == undefined){
								data[i][key] = "";
							}
						}
						content += "<div class=\"table-trs\">" +
							"<div class=\"tables-left\" style='margin-left:15px;width:120px;'>" +
								"<div class=\"table-name\" style='width:120px;' title='"+data[i].coursename+"'>"+substr(data[i].coursename,5) + "</div>" +
								"<div class=\"table-code\" style='width:120px;'></div>" +
							"</div>" +
							"<div class=\"tables-middle\" style='margin-left:25%;'>" +
								"<div class=\"table-code\" style='width:200px;'>开始时间： "+getFormatDateByLong(parseInt(data[i].stime)*1000,"yyyy-MM-dd hh:mm")+"</div>" +
								"<div class=\"table-code\" style='width:200px;'>结束时间： "+getFormatDateByLong(parseInt(data[i].etime)*1000,"yyyy-MM-dd hh:mm")+"</div>" +
							"</div>" +
							"<div class=\"tables-right\">" +
								"<div class=\"table-address\">满分值："+data[i].score+"</div>" +
								"<div class=\"table-oprate\">" +
//									"<div class=\"table-score\" examcode=\""+data[i].examcode+"\" coursecode=\""+data[i].coursecode+"\" coursename='"+data[i].coursename+"' title=\"成绩\"></div>" +
									"<div class=\"table-delete\" examcode=\""+data[i].examcode+"\" coursecode=\""+data[i].coursecode+"\" title=\"删除\" style='margin-left:90px'></div>" +
								"</div>" +
							"</div>" +
						"</div>";
					}
					$("#result-form-show").contents().find("#result-data-show").empty();
					$("#result-form-show").contents().find("#result-data-show").append(content);
					
					var cdsH =$("#result-form-show").height() - $("#result-form-show").contents().find(".content-title").height() - 40;
					$("#result-form-show").contents().find(".content-data-show").height(cdsH);
					
					$("#result-form-show").contents().find(".table-trs").unbind("hover");
					$("#result-form-show").contents().find(".table-trs").hover(function(){
						$(this).find(".table-oprate").show();
					},function(){
						$("#result-form-show").contents().find(".table-oprate").hide();
					});
					
					$("#result-form-show").contents().find(".table-score").unbind("click");
					$("#result-form-show").contents().find(".table-score").click(function(){
						var examcode = $(this).attr("examcode");
						var coursecode = $(this).attr("coursecode");
						var coursename = $(this).attr("coursename");
						$("#score-form-show").show();
						$("#right-tables").hide();
						$(".title-search").hide();
						$("#title-search-score").show();
						$("#score-form-show").contents().find("#table-title").html(examname + coursename + "成绩单");
						
						initScoreClass(examcode,coursecode,grade,schooltype);
						
						$("#score-form-show").contents().find("#back-to-table").click(function(){
							$("#score-form-show").hide();
							$("#right-tables").show();
							$(".title-search").hide();
						});
					});
					
					$("#result-form-show").contents().find(".table-delete").unbind("click");
					$("#result-form-show").contents().find(".table-delete").click(function(){
						var examcode = $(this).attr("examcode");
						var coursecode = $(this).attr("coursecode");
						deleteBox("确定要删除吗？",function(){
							deleteCourseRes(examcode,coursecode,examname,grade,schooltype);
						});
					});
				}else{
					content += "<div class=\"table-trs\">" +
									"<div class=\"no-data-show\">没有查到相关结果！</div>" +
								"</div>";
					$("#result-form-show").contents().find("#result-data-show").empty();
					$("#result-form-show").contents().find("#result-data-show").append(content);
				}
			}else{
				processError("查询失败");
				content += "<div class=\"table-trs\">" +
								"<div class=\"no-data-show\">没有查到相关结果！</div>" +
							"</div>";
				$("#result-form-show").contents().find("#result-data-show").empty();
				$("#result-form-show").contents().find("#result-data-show").append(content);
			}
		},null,null);
	}
	//删除科目信息
	function deleteCourseRes(examcode,coursecode,examname,grade,schooltype){
		var userKey = $("#user-name",parent.parent.document).attr("key");
		var data = {
			cmd:"deleteSubjectExamInfo",
			model:"bigexam",
			userKey:userKey,
			data:{
				examcode:examcode,
				coursecode:coursecode
			},
			remark:"",						
		};
		processBegin("正在删除中···");
		AjaxCrud.get(serverUrl.ServerLoginUrl,data,function(res){
			if(res.result == 1){
				processEnd("删除成功");
				getExamResult(examcode,examname,grade,schooltype);
			}else{
				processError("删除失败");
			}
		},null,null);
	}
	
	function initScoreClass(examcode,coursecode,grade,schooltype){
		var typeOpt = "";
		var res = classCaches;
		if(res.result == 1 && res.data != undefined && res.data != ""){
			var data = res.data;
			var name = "";
			if(schooltype == "0"){
				name = "幼儿园";
			}else if(schooltype == "1"){
				name = "小学";
			}else if(schooltype == "2"){
				name = "中学";
			}else if(schooltype == "3"){
				name = "高中";
			}
			typeOpt += "<option value='"+schooltype+"' selected='selected'>"+name+"</option>";
			$("#score-type").html(typeOpt);
			
			var gradeOpt = "";
			if(schooltype != ""){
				for(var i = 0; i < data.length; i++){
					if(data[i].type == schooltype){
						gradeData = data[i].data;
					}
				}
				for(var i = 0; i < gradeData.length; i++){
					if(gradeData[i].grade == grade){
						gradeOpt += "<option value='"+gradeData[i].grade+"' classcodes='"+gradeData[i].classcode+"' classes='"+gradeData[i].classes+"' selected='selected'>"+gradeData[i].grade+"年级</option>";
					}
				}
			}
			$("#score-grade").html(gradeOpt);
			
			var classOpt = "<option value='' classes=''>班级</option>";
			var classes = $("#score-grade option:selected").attr("classes").split(",");
			var classcodes = $("#score-grade option:selected").attr("classcodes").split(",");
			for(var j = 0; j < classes.length; j++){
				classOpt += "<option value='"+classcodes[j]+"' classes='"+classes[j]+"'>"+classes[j]+"班</option>";
			}
			$("#score-classcode").html(classOpt);
			
			$("#score-classcode").unbind("change");
			$("#score-classcode").change(function(){
				getScoreResult(examcode,coursecode,grade,schooltype);
			});
		}else{
			
		}
		getScoreResult(examcode,coursecode,grade,schooltype);
	}
	//点击科目查看该科目的成绩单信息
	function getScoreResult(examcode,coursecode,grade,schooltype){
		processBegin("正在运行中···");
		var userKey = $("#user-name",parent.parent.document).attr("key");
		var schoolcode = $("#user-name",parent.parent.document).attr("schoolcode");
		var classcode = $("#score-classcode option:selected").val();
		var data = {
				cmd:"getEveryExamInfo",
				model:"bigexam",
				userKey:userKey,
				data:{
					examcode:examcode,
					coursecode:coursecode,
					schoolcode:schoolcode,
					grades:grade,
					schooltype:schooltype,
					classcode:classcode,
				},
				remark:"",						
		};
		AjaxCrud.get(serverUrl.ServerLoginUrl,data,function(res){
			var content = "";
			if(res.result == 1 && res.data != undefined && res.data != ""){
				processEnd("查询成功");
				var data = res.data.data;
				if(data.length > 0){
					for(var i = 0; i < data.length; i++){
						for(var key in data[i]){
							if(data[i][key] == null || data[i][key] == "null" || data[i][key] == undefined){
								data[i][key] = "";
							}
						}
						content += "<div class=\"table-trs\">" +
							"<div class=\"tables-left\" style='margin-left:15px;width:120px;'>" +
								"<div class=\"table-name\" style='width:120px;' title='"+data[i].studentname+"'>"+substr(data[i].studentname,5) + "</div>" +
								"<div class=\"table-code\" style='width:120px;'>"+data[i].studentcode+"</div>" +
							"</div>" +
							"<div class=\"tables-middle\" style='margin-left:25%;'>" +
								"<div class=\"table-class\" style='width:200px;'>分数： "+data[i].scorenumber+"</div>" +
								"<div class=\"table-code\" style='width:200px;'>"+data[i].classesname+"</div>" +
							"</div>" +
							"<div class=\"tables-right\">" +
								"<div class=\"table-address\">校排名："+data[i].schoolrank+"</div>" +
								"<div class=\"table-address\">班内排名："+data[i].classranking+"</div>" +
							"</div>" +
						"</div>";
					}
					$("#score-form-show").contents().find("#result-data-show").empty();
					$("#score-form-show").contents().find("#result-data-show").append(content);
					
					var cdsH =$("#score-form-show").height() - $("#score-form-show").contents().find(".content-title").height() - 40;
					$("#score-form-show").contents().find(".content-data-show").height(cdsH);
					
					//导出成绩单
					$("#score-form-show").contents().find("#leadingout-btn").unbind("click");
					$("#score-form-show").contents().find("#leadingout-btn").click(function(){
						exportScore(examcode,coursecode,grade,schooltype);
					
					});
				}else{
					content += "<div class=\"table-trs\">" +
									"<div class=\"no-data-show\">没有查到相关结果！</div>" +
								"</div>";
					$("#score-form-show").contents().find("#result-data-show").empty();
					$("#score-form-show").contents().find("#result-data-show").append(content);
				}
			}else{
				processError("查询失败");
				content += "<div class=\"table-trs\">" +
								"<div class=\"no-data-show\">没有查到相关结果！</div>" +
							"</div>";
				$("#score-form-show").contents().find("#result-data-show").empty();
				$("#score-form-show").contents().find("#result-data-show").append(content);
			}
		},null,null);
	}
	//编辑考试
	function updataExam(examcode){
		var userKey = $("#user-name",parent.parent.document).attr("key");
		var rolecode = $("#user-name",parent.parent.document).attr("rolecodes");
		var schoolcode = $("#user-name",parent.parent.document).attr("schoolcode");
		var classcodeArr = [];
		$("#exam-form-show").contents().find(".classcode-item input:checked").each(function(){
			classcodeArr.push(this.value);
		});
		var list = [];
		$("#exam-form-show").contents().find(".add-info-edit").each(function(i){
			var param = {};
			param.examcode = examcode;
			param.rolecode = rolecode;
			param.schoolcode = schoolcode;
			param.examname = encodeURI($("#exam-form-show").contents().find("#exam-examname").val());
			param.schooltype = $("#exam-form-show").contents().find("#exam-type option:selected").val();
			param.grades = $("#exam-form-show").contents().find("#exam-grade option:selected").val();
			param.classcode = classcodeArr.join(","); 
			param.describe = encodeURI($("#exam-form-show").contents().find("#exam-describe").val());
			$(this).children().each(function(j){
				if(j == 0){
					param["stime"] = strToDate(this.value + ":00")/1000;
					return true;
				}else if(j == 1){
					param["etime"] = strToDate(this.value + ":00")/1000;
					return true;
				}else if(j == 2){
					param["coursecode"] = this.value;
					param["coursename"] = encodeURI($(this).find("option:selected").attr("coursename"));
					return true;
				}else if(j == 3){
					param["score"] = this.value;
					return true;
				}
				
			});
			list.push(param);
		});
		var data = {
				cmd:"UpdateExamInfo",
				model:"bigexam",
				userKey:userKey,
				data:JSON.stringify(list),
				remark:"",						
		};
		processBegin("正在保存中···");
		AjaxCrud.add(serverUrl.ServerLoginUrl,data,function(res){
			if(res.result == 1){
				processEnd("修改成功");
				$("#exam-form-show").hide();
				$("#right-tables").show();
				currentPage = 1;
				initExam(currentPage,pageSize);
			}else{
				processError("修改失败");
			}
		},null,null);
	}
	//删除考试
	function deleteExam(examcode){
		var userKey = $("#user-name",parent.parent.document).attr("key");
		var rolecode = $("#user-name",parent.parent.document).attr("rolecodes");
		var schoolcode = $("#user-name",parent.parent.document).attr("schoolcode");
		var data = {
				cmd:"deleteExamInfo",
				model:"bigexam",
				userKey:userKey,
				data:{
					examcode:examcode,
					rolecode:rolecode,
					schoolcode:schoolcode
				},
				remark:"",						
		};
		processBegin("正在删除中···");
		AjaxCrud.get(serverUrl.ServerLoginUrl,data,function(res){
			if(res.result == 1){
				processEnd("删除成功");
				currentPage = 1;
				initExam(currentPage,pageSize);
			}else{
				processError("删除失败");
			}
		},null,null);
	}
	
	function check2(){
		var flg = false;
		var checkFails = $("#exam-form-show").contents().find(".check-fail");
		for(var i = 0; i < checkFails.length; i++){
			if(checkFails[i].innerHTML != ""){
				flg = false;
				break;
			}else{
				flg = true;
			}
		}
		var checkCont = $("#exam-form-show").contents().find(".info-error");
		for(var i = 0; i < checkCont.length; i++){
			if(checkCont[i].innerHTML != ""){
				flg = false;
				break;
			}else{
				flg = true;
			}
		}
		return flg;
	}

	function checkSave(){
		var flag = false;
		var parame = ["examname","classcode","describe","stime","etime","coursecode","score"];
		for(key in parame){
			if(key == "1"){
				if($("#exam-form-show").contents().find(".classcode-item input:checked").length == 0){
					$("#exam-form-show").contents().find("#exam-classcode").focus();
					$("#exam-form-show").contents().find("#exam-classcode-ex").text("不能为空！");
					return false;
				}else{
					$("#exam-form-show").contents().find("#exam-classcode-ex").text("");
					flag = true;
				};
			}else if(key == "3" || key == "4" || key == "5" || key == "6" ){
				$("#exam-form-show").contents().find(".add-info-edit").each(function(){
					var index = $(this).attr("index");
					$(this).children().each(function(){
						if(this.value == ""){
							$("#exam-form-show").contents().find("#info-error" + index).html("不能为空！");
							return false;
						}else{
							$("#exam-form-show").contents().find("#info-error" + index).html("");
							flag = true;
						};
					});
				});
			}else{
				if($("#exam-form-show").contents().find("#exam-" + parame[key]).val() == ""){
					$("#exam-form-show").contents().find("#exam-" + parame[key]).focus();
					$("#exam-form-show").contents().find("#exam-" + parame[key] + "-ex").text("不能为空！");
					return false;
				}else{
					flag = true;
				};
			};
		}
		return flag;
	}
	function exportRanking(examcode){
		var grade = $("#ranking-grade option:selected").val();
		var classcode = $("#ranking-classcode option:selected").val();
		var schoolcode = $("#user-name",parent.parent.document).attr("schoolcode");
		window.frames["export"].location = serverUrl.ExportUrl + "?t=" + Math.random() + "&cmd=getExamTotalList" + "&examcode=" + examcode + "&schoolcode=" + schoolcode + "&classcode=" + classcode + "&grades=" + grade + "&fileName=" + new Date().getTime();
	}
	function exportScore(examcode,coursecode,grade,schooltype){
		var schoolcode = $("#user-name",parent.parent.document).attr("schoolcode");
		window.frames["export"].location = serverUrl.ExportUrl + "?t=" + Math.random() + "&cmd=getEveryExamInfo" + "&coursecode=" + coursecode + "&examcode=" + examcode + "&schoolcode=" + schoolcode + "&schooltype=" + schooltype + "&grades=" + grade + "&fileName=" + new Date().getTime();
	}
	function substr(str,len){
		if(str != undefined){
			if(str.length > len){
				str = str.substring(0,len-2)+"...";
				return str;
			}else{
				return str;
			}
		}else{
			return "";
		}
	}
	
	
	function pagebtns(){
		$("#exam-search-btn").click(function(){
			now = 0;
			initExam(1,pageSize);
		});		
		
	}
	function initSmPages(){
		var rcH = $(".body-right",parent.document).height() - $(".right-title").height()-3;
		$(".right-content").height(rcH);
		
		var cdsH = $(".right-content").height() - $(".content-title").height() - 40;
		$(".content-data-show").height(cdsH);
	}
})();